<%--
 *  File:   ZylEmployeeCollateSummary.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		  Changes
 *  2011-11-17	  KevinFan		  Created
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
  //init param
  String strModuleName = "COM";
  String privilegeCode = "A0702,A0703,A0704";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>EmployeeCollateSummary</title>
<PageFlow:CheckPageFlow pageName="p_employeecollatesummary"/>
<%
   Vector summary = (Vector)pageContext.getAttribute("totalsummary");
   if(summary == null)summary = new Vector();
%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/opal2/mootools.js"></script>
<%@ include file="/inc/NewCalendar.inc" %>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname){
	var editform = summaryPrepare(cform,actionvalue,orderbyname);
	if(!editform) return;
	editform.action = "ZylEmployeeCollateSummary.jsp?<%= OvalTools.randomURL() %>";
	editform.target = "_self";
	isRunning = true;
	editform.submit();
 }
//getbusinessarea

function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_getemployeecollate");
	datahandler.runDataHandler();
}

function page_download(){
	dealercode = document.cform.serdealercode.value;	
	dealername =document.cform.serdealername.value;
	customercode =document.cform.sercustomercode.value;
	customername = document.cform.sercustomername.value;
	prodcode =document.cform.serprodcode.value;
	prodname= document.cform.serprodname.value;
	assignercode = document.cform.serassignercode.value;
	assignername = document.cform.serassignername.value; 
	employeecode = document.cform.seremployeecode.value;
	employeename = document.cform.seremployeename.value;
	serstatus = document.cform.serstatus.value;
	regionid = document.cform.regionid.value;
	years = document.cform.years.value;
	months = document.cform.months.value;
	userid = document.cform.userid.value;
	businessarealist = document.cform.businessarealist.value;
 	strurl = "<%= reportURL %>/servlet/ExcecuteReport/EmployeeCollateData.sox?__folder=/ovalreport&rownum=2&dealercode="+dealercode+"&dealername="+escape(encodeURI(dealername))+"&regionid="+regionid+"&businessarealist="+businessarealist+"&serstatus="+serstatus+"&customercode="+customercode+"&prodcode="+prodcode+"&customername="+escape(encodeURI(customername))+"&prodname="+escape(encodeURI(prodname))+"&assignercode="+assignercode+"&employeecode="+employeecode+"&assignername="+escape(encodeURI(assignername))+"&employeename="+escape(encodeURI(employeename))+"&years="+years+"&months="+months;
	businesstype = cform.businesstype.value;
	if(businesstype==3)
		strurl = strurl + "&employeeid2="+userid;
	else if(businesstype==2)
		strurl = strurl + "&employeeid1="+userid;
	else
		strurl = strurl + "&employeeid="+userid;
	window.location.href = strurl
 }
function page_upload(){
		this.location.href = "<%= contextPath%>/phap/masterdata/spm/UploadEXL.jsp?first=ZZ&second=ZB01&third=Z0608&<%= OvalTools.randomURL() %>";
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
<input type="hidden" name="pagename" value="p_employeecollatesummary">
<input type="hidden" name="actionname">
<custom:hidden property="flag" value="Y"/>
<custom:hidden property="businesstype"/>
<custom:hidden property="userid" name="userinfo" scope="session"/>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" onkeydown="if(event.keyCode==13) page_summary('search');">
        
		<tr>
	        <td class="td_right" width="9%"><%= "经销商编码" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" width="11%">
                <custom:text property="serdealercode" size="15" />
			</td>
			<td class="td_right" width="9%"><%= "非锁客户编码" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" width="11%">
                <custom:text property="sercustomercode" size="15" />
			</td>
			<td class="td_right" width="9%"><%= "产品编码" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" width="11">
                <custom:text property="serprodcode" size="15" />
			</td>
			<td class="td_right" width="9%"><%= "分配人工号" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" width="11%">
                <custom:text property="serassignercode" size="15" />
			</td>
			<td class="td_right" width="9%"><%= "代表工号" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" width="11%">
                <custom:text property="seremployeecode" size="15" />
			</td>
        </tr>
		<tr>
			<td class="td_right"><%= "经销商名称" + label.getLabelName("L_Colon") %></td>
            <td class="td_left">
                <custom:text property="serdealername" size="15" />
			</td>
			<td class="td_right"><%= "非锁客户名称" + label.getLabelName("L_Colon") %></td>
            <td class="td_left">
                <custom:text property="sercustomername" size="15" />
			</td>
			<td class="td_right"><%= "产品名称" + label.getLabelName("L_Colon") %></td>
            <td class="td_left">
                <custom:text property="serprodname" size="15" />
			</td>
			<td class="td_right"><%= "分配人名称" + label.getLabelName("L_Colon") %></td>
            <td class="td_left">
                <custom:text property="serassignername" size="15" />
			</td>
			<td class="td_right"><%= "代表名称" + label.getLabelName("L_Colon") %></td>
            <td class="td_left">
                <custom:text property="seremployeename" size="15" />
			</td>
        </tr>
		<tr>
			<td class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
			<td class="td_left"><custom:select property="regionid" optionInnerTextKey="regionname" style="width:160px" optionsName="resultregion" optionValueKey="regionid" onchange="page_getpriviceoffice()" defaultValue="ALL" defaultValueCost=""/></td>
			<td class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
			<td class="td_left">
			<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" defaultValue="----------" style="width:180px" defaultValueCost=""/> </td>
			<td class="td_right" ><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        <td class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" label="L_Year1"/></td>
	        <td class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        <td class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" label="L_Month"/></td>
			<td class="td_right"><%= "状态" + label.getLabelName("L_Colon") %></td>
            <td class="td_left" colspan="7">
				<custom:selectdic dictType="AssignStatus" property="serstatus" defaultValue="------" defaultValueCost=""/>
				&nbsp;&nbsp;
				<a href="javascript:page_summary('search')"><img src="/oval/images/cn/go.gif" border="0" ></a>
			</td>
			<td width="*" colspan="7">&nbsp;</td>
		</tr>
      </table>
    </td>
  </tr>
  <tr>
	<td colspan="2">
      <div style="width:100%;height=400;overflow=auto;">
      <table width="110%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left"> 
          <td width="1%" class="title_center">&nbsp;</td>
          <td class="title_center">经销商</td>
          <td class="title_center">非锁客户</td>
          <td class="title_center">产品</td>
          <td class="title_center">代表</td>
		  <td class="title_center">销售数量</td>
          <td class="title_center">分配人</td>
          <td class="title_center">分配时间</td>
          <td class="title_center">审核时间</td>
		  <td class="title_center">状态</td>
        </tr> 
        <tbody> 
          <%
            int i=0;
            String strChecked = "";
            String strClassType = "none";
            boolean bHasChecked = false;
          %>
          <logic:iterate id="onerow" collection="<%= summary %>">
          <%
            if(i%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
            if(!bHasChecked){
              bHasChecked = true;
              strChecked = "Checked";
            }else{
              strChecked = "";
            }
            i++;
          %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" onClick="radiotrue('radio<%=JspHelper.filterNull( i )%>')" class="<%=JspHelper.filterNull( strClassType )%>">
            <td>
              <input <%=JspHelper.filterNull( strChecked )%> id="radio<%=JspHelper.filterNull(i)%>" name="radiorow" type="radio" class="normalradio">
            </td>
            <td><custom:write name="onerow" property="dealercode" nbsp="true"/>&nbsp;&nbsp;<custom:write name="onerow" property="dealername" nbsp="true"/></td>
            <td><custom:write name="onerow" property="customercode" nbsp="true"/>&nbsp;&nbsp;<custom:write name="onerow" property="customername" nbsp="true"/></td>
            <td><custom:write name="onerow" property="prodcode" nbsp="true"/>&nbsp;&nbsp;<custom:write name="onerow" property="prodname" nbsp="true"/></td>
            <td><custom:write name="onerow" property="employeecode" nbsp="true"/>&nbsp;&nbsp;<custom:write name="onerow" property="employeename" nbsp="true"/></td>
			<td><custom:write name="onerow" property="salesqty" nbsp="true"/></td>
            <td><custom:write name="onerow" property="assignercode" nbsp="true"/>&nbsp;&nbsp;<custom:write name="onerow" property="assignername" nbsp="true"/></td>
            <td><custom:write name="onerow" property="assigndate" dataType="date" dataFormat="yyyy-MM-dd HH:mm:ss" nbsp="true"/></td>
			<td><custom:write name="onerow" property="commitdate" dataType="date" dataFormat="yyyy-MM-dd HH:mm:ss" nbsp="true"/></td>
            <td><custom:write name="onerow" property="status" nbsp="true" dictType="AssignStatus"/></td>
          </tr>
          </logic:iterate>
        </tbody> 
        <tfoot> 
	        <tr> 
	          <td colspan="31"> 
	          <%@ include file="/inc/SummaryAction.inc" %>
	          </td>
	        </tr>
	        </tfoot> 
      </table>
	  </div>
    </td>
  </tr>
  <tr>
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td class="td_center" colspan="100">
			   <a onClick="page_upload()"><custom:button type="1" label="L_Upload" imgsrc="back.gif" border="0" style="width:80"/></a>
			   &nbsp;&nbsp;
			   <a onClick="page_download()"><custom:button type="1" label="L_Download" imgsrc="back.gif" border="0" style="width:80"/></a>
			</td>
		</tr>
	</table>
  </tr>
 </table>
 </form>
</body>
</html>